<template>
  <button @click="loadApp">点击加载子应用</button>
  <div id="load-subapp-viewport" ref="containerRef"></div>
</template>

<script lang="ts" setup>
import { loadMicroApp } from "qiankun";
import { ref } from "vue";

const containerRef = ref<null | HTMLElement>(null);

const loadApp = () => {
  if (!containerRef.value) {
    return;
  }
  loadMicroApp({
    name: "sub-vanilla",
    entry: "//localhost:7003",
    container: "#load-subapp-viewport",
    // container: containerRef.value as HTMLElement,
  });
};
</script>

<style scoped></style>
